<?php

/*
	This file is part of Mandragon.

    Mandragon is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    Mandragon is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with Mandragon.  If not, see <http://www.gnu.org/licenses/>.
*/
	
require_once 'PHPUnit/Framework.php';
require_once 'autoload.php';

class TestTopic extends PHPUnit_Framework_TestCase {
	function test_check_content() {
		$expected_values = 'values';
		$expected_results = 'results';

		$page = new Page();
		$topic = new Topic($page);

		$mock_input_checker = $this->getMock('InputChecker');
		$mock_input_checker->expects($this->once())
				->method('checkExistsAndTags')
				->with($expected_values, 'info', 'info')
				->will($this->returnValue($expected_results));
		$topic->set_input_checker($mock_input_checker);

		$actual = $topic->check_content($expected_values, false);
		$this->assertEquals($expected_results, $actual);
	}

	function test_check_content_with_new() {
		$expected_values = 'values';
		$expected_results = 'results';

		$page = new Page();
		$topic = new Topic($page);

		$mock_input_checker = $this->getMock('InputChecker');
		$mock_input_checker->expects($this->once())
				->method('checkBody')
				->with($expected_values)
				->will($this->returnValue($expected_results));
		$topic->set_input_checker($mock_input_checker);

		$actual = $topic->check_content($expected_values, true);
		$this->assertEquals($expected_results, $actual);
	}
}

?>
